package com.wanmait.meteor.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wanmait.meteor.mapper.UserinfoMapper;
import com.wanmait.meteor.pojo.Userinfo;
import com.wanmait.meteor.service.UserInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Resource
    private UserinfoMapper userinfoMapper;

    @Override
    public Userinfo findById(Integer id) {
        return null;
    }

    @Override
    public Userinfo login(Userinfo userinfo) {
        Userinfo loginUserinfo=userinfoMapper.login(userinfo);
        return loginUserinfo;
    }

    @Override
    public PageInfo<Userinfo> selectList(Userinfo userinfo, Integer pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);
        List<Userinfo> userinfos=userinfoMapper.selectList(userinfo);
        PageInfo<Userinfo> pageInfo=new PageInfo<>(userinfos);
        return pageInfo;
    }

    @Override
    public void delUserinfo(Integer id) {
        userinfoMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Userinfo selectAUser(Integer id) {
        return userinfoMapper.selectByPrimaryKey(id);
    }

    @Override
    public void insert(Userinfo userinfo) {

    }

    @Override
    public List<Userinfo> findAll() {
        return null;
    }

    @Override
    public void update(Userinfo userinfo) {

    }
}
